home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo / UMouseTrackBehavior.h < prev   
Encoding:
Text File  |  1995-02-13  |  2.5 KB  |  132 lines  |  [TEXT/MPS ]

  1. //     UMouseTrackBehavior.h
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMouseTrackBehavior class definitions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11. #ifndef __UMOUSETRACKBEHAVIOR__
  12. #define __UMOUSETRACKBEHAVIOR__
  13.  
  14.  
  15. #ifndef __UBEHAVIOR__
  16. #include <UBehavior.h>
  17. #endif
  18.  
  19. #ifndef __UFLOATWINDOW__
  20. #include <UFloatWindow.h>
  21. #endif
  22.  
  23. #ifndef __UMENUMGR__
  24. #include <UMenuMgr.h>
  25. #endif
  26.  
  27. #ifndef __UFLOATWINDOW__
  28. #include <UFloatWindow.h>
  29. #endif
  30.  
  31. #ifndef __UDIALOG__
  32. #include <UDialog.h>
  33. #endif
  34.  
  35. #ifndef __UDIALOGBEHAVIOR__
  36. #include <UDialogBehavior.h>
  37. #endif
  38.  
  39. #ifndef __UVIEWSERVER__
  40. #include <UViewServer.h>
  41. #endif
  42.  
  43. #ifndef __PACKAGES__
  44. #include <Packages.h>
  45. #endif
  46.  
  47. #ifndef __RESOURCECONSTANTS__
  48. #include "ResourceConstants.h"
  49. #endif
  50.  
  51. // FORWARD STATEMENTS
  52. class TMouseTrackBehavior;
  53. class TSwallowBehavior;
  54. class TTrackWindow;
  55.  
  56.  
  57. // GLOBALS
  58. const IDType kMouseTrackBehavior = 'MTRB';
  59.  
  60. TTrackWindow* gMouseTrackWindow = NULL;            // global TrackWindow hook (one and only)
  61.  
  62.      void InitMouseTrackBehavior();            // initialize our nice behavior (called once)
  63.  
  64.  
  65. //    CLASSES
  66. // floating window used for presentation of the mouse information
  67. DeclareClassDesc(TTrackWindow);
  68.  
  69. class TTrackWindow : public TFloatWindow
  70. {
  71.  
  72.     DeclareClass(TTrackWindow);
  73.  
  74. public:
  75.     virtual      void Close();
  76.     virtual      void GetOriginatorBehavior(TSwallowBehavior*);
  77.  
  78.     TSwallowBehavior* fBehavior;
  79. };
  80.  
  81.  
  82. //    our event swallow behavior, swallows everything
  83. DeclareClassDesc(TSwallowBehavior);
  84.  
  85. class TSwallowBehavior : public TBehavior
  86. {
  87.  
  88.     DeclareClass(TSwallowBehavior);
  89.  
  90. public:
  91.     virtual      void ISwallowBehavior();
  92.     virtual      Boolean DoToolboxEvent(TToolboxEvent* event);
  93.     virtual      void Draw(const VRect& area);
  94.  
  95.     //    FIELDS
  96.     TTrackWindow* fTrackWindow;
  97.     TStaticText* fMouseStatus;
  98.     TStaticText* fVertical;
  99.     TStaticText* fHorizontal;
  100.     VPoint fMouseVPoint;
  101.     short fEventType;
  102. };
  103.  
  104.  
  105. //    the main behavior, which will coordinate swallow behavior and other objects
  106. DeclareClassDesc(TMouseTrackBehavior);
  107.  
  108. class TMouseTrackBehavior : public TBehavior
  109. {
  110.  
  111.     DeclareClass(TMouseTrackBehavior);
  112.  
  113. public:
  114.     virtual      void IMouseTrackBehavior(ResNumber menuID);
  115.     TMouseTrackBehavior();
  116.  
  117.     virtual      void DoSetupMenus();
  118.     virtual      void DoMenuCommand(CommandNumber);
  119.     virtual      void CreateSwallowBehavior();
  120.     virtual      void CreateWindoid();
  121.  
  122.     //    FIELDS
  123.     short fMenuID;
  124.     TTrackWindow* fWindoid;
  125. };
  126.  
  127.  
  128.  
  129.  
  130. #endif
  131.  
  132.